import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  routes: [
    {
      path: '/',
      component: () => import('@/page/index'),
      children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/page/home'),
      },
      {
        path: '/outFootball',
        name: 'outFootball',
        component: () => import('@/page/outFootball'),
      },
      {
        path: '/list/:api',
        name: 'list',
        component: () => import('@/page/list'),
      }, {
        path: '/comprehensive',
        name: 'comprehensive',
        component: () => import('@/page/comprehensive'),
      }, {
        path: '/cba',
        name: 'cba',
        component: () => import('@/page/cba'),
      }, {
        path: '/nba',
        name: 'nba',
        component: () => import('@/page/nba'),
      }, {
        path: '/gnfoot',
        name: 'gnfoot',
        component: () => import('@/page/gnFoot'),
      }, {
        path: '/premier',
        name: 'premier',
        component: () => import('@/page/premier'),
      }, 
    ]
    },
    {
      path: '/H5Index',
      name: 'H5Index',
      component: () => import('@/page/move'),
    }
  ],
    //进入页面就到定点到顶点
    scrollBehavior(to, from, savedPosition) {
      return {
        x: 0,
        y: 0
      }
    }
  
})


